Make container names unique and migrate all tests to singletons#22294
Draft
gnodet wants to merge 3 commits intoapache:mainfrom
Draft
Make container names unique and migrate all tests to singletons#22294gnodet wants to merge 3 commits intoapache:mainfrom
gnodet wants to merge 3 commits intoapache:mainfrom
Conversation
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
4061f61 to
36d7b4f
Compare
Contributor
|
LGTM, but this one likely needs a full CI test to make sure it runs fine. |
Contributor
Author
Yes, I'm running tests locally for each modified factory to make sure it works. It's not completely done yet... |
3f7fe53 to
d68f67d
Compare
16de556 to
fdb9557
Compare
Append PID and AtomicInteger counter to container names generated by ContainerEnvironmentUtil.containerName(). This prevents container name collisions both across JVMs (parallel builds via mvnd) and within the same JVM (singleton containers coexisting with tests that create their own containers). Also remove hardcoded container name from RocketMQNameserverContainer which bypassed ContainerEnvironmentUtil. The network alias "nameserver" (which is network-scoped) is sufficient for inter-container communication. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
17c3c4c to
d2a0b14
Compare
Add singleton service support to all test-infra service factories that previously only had createService(). Each follows the established pattern (inner SingletonXxxService, lazy holder, factory method). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ce() Migrate every test class that used createService() to use createSingletonService(). Tests that needed isolation fixes: - Google PubSub: catch AlreadyExistsException for reruns + unique topic names for conflicting test pairs (DeadLetterIT/MessageOrderingIT, CustomSerializerIT/BodyTypesIT, SingleExchangeRound*IT) - Hashicorp Vault: secretPath() helper using getClass().getSimpleName() for per-class secret path isolation - Spring-RabbitMQ: uniqueName() helper for exchange/queue names - LRA: delta-tolerant assertions for shared coordinator state - Consul: remove manual initialization (singleton handles lifecycle) 89 test files migrated across 30+ components. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes test infrastructure safe for both cross-JVM (mvnd parallel builds) and within-JVM (parallel test classes) execution by ensuring Docker container name uniqueness and migrating tests to share singleton service instances.
Commit 1: Make Docker container names unique per instance
ContainerEnvironmentUtil.containerName()for cross-JVM and within-JVM uniqueness"nameserver"fromRocketMQNameserverContainer(the network alias is sufficient for inter-container communication)Commit 2: Add
createSingletonService()to 32 test-infra service factoriesKafkaServiceFactorypattern (inner singleton class, lazy holder, factory method) to 32 service factories that previously only hadcreateService()SingletonService.shutdown()from throwingIllegalArgumentExceptionto a debug-level no-op, since many service interfaces haveafterEachlifecycle callbacks that callshutdown()(e.g.,ChatScriptService,CliService)Commit 3: Migrate all test classes from
createService()tocreateSingletonService()createService()tocreateSingletonService()to share Docker containers across test classesgetClass().getSimpleName()for unique secret paths per test classcreateService()for tests that need exclusive instances:BaseExclusiveKafkaTestSupport(intentionally needs isolation)KafkaHealthCheckTestSupport(tests intentionally shut down Kafka to verify health check DOWN behavior)AbstractLRATestSupport(LRA coordinator state leaks between test classes)MasterEndpointFailoverIT(manages its own ZooKeeper lifecycle)Test plan